package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.DishesRecipe;
import com.example.pojo.RecipeInfo;
import com.example.pojo.dto.DishRecipeDTO;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DishesRecipeMapper extends BaseMapper<DishesRecipe> {
    @Select("SELECT ri.* " +
            "FROM recipe_info ri " +
            "WHERE ri.recipe_id IN (" +
            "   SELECT dr.recipe_id " +
            "   FROM dishes_recipe dr " +
            "   INNER JOIN dishes_info di ON dr.dish_id = di.dish_id" +
            ")")
    List<RecipeInfo> selectRecipesWithDishes();

}
